IdeaBlade.EntityModel Assembly > IdeaBlade.EntityModel Namespace > EntityScalarAsyncExtensions Class > SingleOrDefault Method : SingleOrDefault<TSource>(IEntityScalarQuery<TSource>) Method |
'Declaration
<ExtensionAttribute()> Public Overloads Shared Function SingleOrDefault(Of TSource)( _ ByVal source As IEntityScalarQuery(Of TSource) _ ) As Task(Of TSource)
'Usage
Dim source As IEntityScalarQuery(Of TSource) Dim value As Task(Of TSource) value = EntityScalarAsyncExtensions.SingleOrDefault(Of TSource)(source)
[Extension()] public static Task<TSource> SingleOrDefault<TSource>( IEntityScalarQuery<TSource> source )
public async void AsyncSingleOrDefault() { Employee emp = await _entityManager.Employees.Where(e => e.Id == 1).AsScalarAsync().SingleOrDefault(); }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2